<!-- Teacher_NewCourseList.html -->
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>教师课程列表</title>
		<link rel="stylesheet" type="text/css" href="../../css/api.css" />
		<link rel="stylesheet" href="../../css/mui.min.css"/>
		<link rel="stylesheet" href="../../css/base.css"/>
		<link rel="stylesheet" href="../../css/CFNetPP_Base.css">
		<style type="text/css">
			.mui-table-view{
				margin-left: 0;
			}
			.mui-table-view-cell>a:not(.mui-btn){
				padding: 10px;
			}
			.mui-table-view-cell>a:not(.mui-btn) .course-img{
				display:block;
				width: 136px;
				max-width: 136px;
				height: 84px;
				background-image: url(../../image/course_placehoder.png);
				background-size: 136px 84px;
			}
			.mui-table-view-cell .top-content{
				height: 40px;
			}
			.mui-table-view-cell .bottom-content{
				/*padding-top: 16px;*/
				height: 44px;
			}
			.mui-table-view-cell>a:not(.mui-btn) .course_title{
				overflow: hidden;
			 	text-overflow: ellipsis;
			 	white-space: pre-wrap;
			 	display: -webkit-box;
			 	-webkit-line-clamp: 2;
			 	-webkit-box-orient: vertical;
			 	font-size: 14px;
			 	color: #222;
			 	line-height: 20px;
			}
			.mui-table-view-cell>a:not(.mui-btn) .subtitle{
				color: #999;
				font-size: 12px;
				overflow: hidden;
				white-space: normal;
			 	text-overflow: ellipsis;
			 	line-height: 14px;
			}
			/*.subtitle .right-span{
				margin-left: 10px;
			}*/
			.subtitle-red{
				color: #e10d20;
				font-size: 12px;
				margin: 0;
			}
			.cell-btn{
				font-size: 12px;
			    font-weight: 400;
			    line-height: 1.2;
			    padding: 4px 6px;
			    border-color: #1da4e8;
			    background-color: #1da4e8;
			    color: white;
			    width: 70px;
			}	
			.cell-btn:enabled:active{
				background-color: #2db4f8;
			}
			.bottom-content .cell-content-left{
				padding-right: 68px;
				float: left;
			}
			.bottom-content .cell-content-right{
				padding-top: 10px;
				width: 68px;
				height: 42px;
				float: right;
				position: absolute;
				right: 10px; 
				top: 50px;
			}
			.button-super-div{
				padding: 2px 0;
			}
			.course-status-tag{
				position: absolute;
				bottom: 10px;
				left: 10px;
				font-size: 12px;
				color: white;
				padding: 2px 4px;
				line-height: 1em;
				width: 136px;
				background-color: rgba(0,0,0,0.5);
				text-align: center;
			}
			.course-status-tag-red{
				background-color: #EC1A2B;
			}
			.course-status-tag-green{
				background-color: #1DBF53;
			}
			.tag-img{
				width: 12px;
				height: 12px;
				margin-right: 4px;
			}
			.cell-btn{
				margin-right: 10px;
			}
			.info-span{
				margin-left: 10px;
			}
			.mui-table-view .mui-media-object.mui-pull-left{
				margin-right: 12px;
			}
			.top-p{
				margin-top: 10px;
			}
			.bottom-p{
				margin-top: 6px;
			}
			.top-blank-div{
				height: 8px;
				padding: 4px;
				background-color: #f3f5f7;
			}
			.plan-name-title{
				font-size: 14px;
				color: #222;
				line-height: 14px;
				height: 14px;
				overflow: hidden;
			 	text-overflow: ellipsis;
			 	display: -webkit-box;
			 	-webkit-line-clamp: 1;
			 	-webkit-box-orient: vertical;
			}
			.right-content{
				width: 40px;
				float: right;
				margin-top: -12px;
			}
			.left-content{
				margin-right: 40px;
			}
			.cell-right-btn{
				width: 40px;
				height: 24px;
			}
			.mui-table-view-cell {
			    padding: 10px;
			}
			.mui-table-view-cell>a:not(.mui-btn) {
			    padding: 10px;
			    margin: -10px;
			}
			.course-type-tag{
				font-size: 12px;
				width: 40px;
				height: 16px;
				text-align: center;
				line-height: 16px;
				color: white;
				background-color: #DB112F;
				position: absolute;
				left: 106px;
				top: 10px;
			}
			.plan-arrow{
				position: absolute;
				right: 10px;
				top: 9px;
				height: 16px;
			}
		</style>
	</head>
	<body>
		<ul id="tesacherTableView" class="mui-table-view">
			<!-- <li class="mui-table-view-cell top-blank-div"></li>
			<li class="mui-table-view-cell">
				<p class="plan-name-title">
					计划一
				</p>
				<img class="plan-arrow" src="../../image/icon_youcejiantou.png">
			</li>
			<li class="mui-table-view-cell mui-media">
				<a href="javascript:;">
					<p class="course-status-tag">已结束</p> 
					<p class="course-type-tag">授课</p>
					<img class="mui-media-object mui-pull-left course-img" src="../../image/list-default.png"/>
					<div class="mui-media-body top-content">
						<p class="course_title">课程名称</p>
					</div>
					<div class="mui-media-body bottom-content">
						<div class="top-p">
							<p class="mui-ellipsis subtitle">
								<span class="left-span"><img class="tag-img" src="../../image/icon_keshi.png">100课时</span>
							</p>
						</div>
						<div class="bottom-p">
							<div class="right-content">
								<button type="button" class="mui-btn cell-btn cell-right-btn">
									批卷
								</button>
							</div>
							<div class="left-content">
								<p class="mui-ellipsis subtitle">
									<span class="left-span"><img class="tag-img" src="../../image/icon_ren.png">100人</span>
									<span class="info-span"><img class="tag-img" src="../../image/icon_shijian.png">10分</span>
								</p>
							</div>
						</div>
					</div>
				</a>
			</li> -->
			<!-- <li class="mui-table-view-cell mui-media">
				<a href="javascript:;">
					<p class="course-status-tag">已结束</p>
					<img class="mui-media-object mui-pull-left course-img" src="../../image/list-default.png">
					<div class="mui-media-body top-content">
						<p class="course_title">MOOC课程家职业资格高级物流师培训班的通知</p>
					</div>
					<div class="mui-media-body bottom-content">
						<div class="right-content">
							<button type="button" class="mui-btn cell-btn">
								进入考试
							</button>
						</div>
						<div class="left-content">
							<p class="mui-ellipsis subtitle top-p">授课老师：江玄燕</p>
							<p class='mui-ellipsis subtitle small-title bottom-p'>
								<span class="left-span">
									自由课程
								</span>
								<span class="right-span">
									已学习
									<span class="subtitle-red">2</span>
									/12
								</span>
							</p>
						</div>
					</div>
				</a>
			</li> -->
		</ul>
		<div class="noSign" hidden="hidden" id="noData">
			<img src="../../image/icon_img.png" width="60%">
			<p class="font16 top_15 base_dark_grey" >
				暂无数据
			</p>
		</div>
		<div class="loadFailure" hidden="hidden" id="noNet">
			<img src="../../image/icon_img01.png" width="60%">
			<p class="" >
				数据加载失败
			</p>
			<p>
				请检查您的网络
			</p>
			<button type="button" class="mui-btn mui-btn-outlined" onclick="refreshData()">
				重新加载
			</button>
		</div>
	</body>
	<script type="text/javascript" src="../../script/jquery.min.js"></script>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<!-- <script type="text/javascript" src="../../script/databaseOperation.js"></script> -->
	<script type="text/javascript" src="../../script/common.js"></script>
	<script type="text/javascript">
		var page = 1;
		var rows = 6;
		var dropRefreshCount = 0;
		var courseDatas = new Array();
		var oneWeek = 7 * 24 * 60 * 60 * 1000;
		var firstLoad = true;
		var currentPlanid = '';
		apiready = function(){
			// $api.setStorage('cfnetppjxid', '158');
			// $api.setStorage('cfnetppuid', '30412');
		    loadNewData();
			setRefreshHeader();
			setPullUpRefresh();
			setupNotifi();
//			 SendBehaviorTrajectoriesNotifi(0, '课程列表', '006');
		}
		function setupNotifi(){
			api.addEventListener({
			    name: 'refreshTeacherCourseListNotifi'
			}, function(ret, err) {
			    loadNewData();
			});
			//自由课程更新进度通知
			api.addEventListener({
			    name: 'freeCourseScheduleNofiti'
			}, function(ret, err) {
			    if (ret) {
			       	var value = ret.value;
			       	var undateCourseid = value.courseid;
			       	var undatePlanid = value.planid;
			       	refreshFreeCourse(undateCourseid, undatePlanid);
			    }
			});
			/**更新学习进度*/
			api.addEventListener({
				name : 'refreshCourseSchedule'
			}, function(ret, err) {
				//暂时屏蔽
				var courseid = ret.value.courseid;
				var pid = ret.value.pid;
				refreshMoocSchedule(courseid, pid);
			});
		}
		//刷新mooc学习进度
		function refreshMoocSchedule(courseid, pid){
			var param = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjxid'),
				pid : pid,
				cid : courseid
			};
			cfnetppPOST(url_getMoocSchedule, param, false, function(data, status){
				if (status == 'success') {
					if (data.code == 200) {
						var schedule = data.data;
						$('#' + courseid).find('.course_schedule').text(schedule);
					}
				}
			});
		}
		//刷新自由课程进度
		function refreshFreeCourse(courseid, planid){
			var param = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjxid'),
				pid : planid,
				cid : courseid
			}
			// console.log(url_freeCourseSchedule+'\n'+JSON.stringify(param));
			cfnetppPOST(url_freeCourseSchedule, param, false, function(data, status){
				// alert(JSON.stringify(data));
				if (status == 'success') {
					if (data.code == 200) {
						var studiedNum = parseInt(numStrWithStr(data.data[0].videosum));
						var allNum = parseInt(numStrWithStr(data.data[0].videosums));
						if (studiedNum > allNum) {
							studiedNum = allNum;
						}
						$('#freeStudied'+courseid).text(studiedNum);
						$('#freeAllChapter'+courseid).text(allNum);
					}
				}
			});
		}
		function numStrWithStr(str){
			if (str == '' || str == null || str == undefined) {
				return '0';
			}
			return str;
		}
		function loadNewData() {
			page = 1;
			currentPlanid = '';
			loadData();
		}
		function loadMoreData() {
			page++;
			loadData();
		}
		//下拉刷新
		function setRefreshHeader() {
			api.setRefreshHeaderInfo({
				visible : true,
				bgColor : '#ccc',
				textColor : '#fff',
				textDown : '下拉刷新...',
				textUp : '松开刷新...',
				showTime : true
			}, function(ret, err) {
				loadNewData();
			});
		}
		// 上拉加载
		function setPullUpRefresh() {
			api.addEventListener({
				name : 'scrolltobottom'
			}, function(ret, err) {
				if (dropRefreshCount >= rows) {
					loadMoreData();
				}
			});
		}
		function loadData(){
			if (firstLoad == true) {
				api.showProgress({
				    style: 'default',
				    animationType: 'fade',
				    title: '加载中...',
				    text: '',
				    modal: false
				});
				firstLoad = false;
			}
			var param = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjxid'),
				page : page,
				rows : rows
			};
			// console.log(JSON.stringify(param)+'\n'+url_teacherCourseListNew);
			cfnetppPOST(url_teacherCourseListNew, param, true, function(data, status) {
				api.refreshHeaderLoadDone();
				api.hideProgress();
				if (status == 'success') {
					if (data.code == 200) {
						if (page == 1) {
							courseDatas = new Array();
						}
						var courseList = data.data;
						multiplePicturesCache({
							picArr : courseList,
							picKey : 'coverimages'
						}, function(imageArr){
							courseList = imageArr;
							if (courseList.constructor == Array) {
								var currentIndex = courseDatas.length;
								dropRefreshCount = courseList.length;//设置当前下拉数
								courseDatas = courseDatas.concat(courseList);
								var courseHtmlString = new String();
								for (var i = currentIndex; i < courseDatas.length; i++) {
									var courseData = courseDatas[i];
									if (currentPlanid != courseData.planid) {
										currentPlanid = courseData.planid;
										courseHtmlString += planTitleHtml(courseData.title, i);
									}
									if(courseData.usertype == 1){
										courseHtmlString += courseHtmlWithData(courseData, i);
									}else{
										courseHtmlString += studyCourseHtmlWithData(courseData, i);
									}
								}
								if (page == 1) {
									$('#tesacherTableView').html(courseHtmlString);
								}else{
									$('#tesacherTableView').append(courseHtmlString);
								}
								addCellClick();
								$('#noData').hide();
								$('#noNet').hide();
							}else{
								if (page == 1) {
									$('#tesacherTableView').html('');
									$('#noData').show();
									$('#noNet').hide();
								}
							}
						});
					} else {
						if (page == 1) {
							$('#tesacherTableView').html('');
							$('#noData').show();
							$('#noNet').hide();
						}else{
							// api.toast({
							// 	msg : '获取数据失败'
							// });
						}
					}
				} else {
					if (page == 1) {
						$('#tesacherTableView').html('');
						$('#noData').hide();
						$('#noNet').show();
					}else{
						api.toast({
							msg : '网络异常'
						});
					}
				}
			});
		}
		
		
	function sendBuriedNotifi(busionessid, pagetype, pagetypeid) {
			var userinfo = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjxid'),
				uname : $api.getStorage('cfnetppusername'),
				
			}
			var data = {
				busionessid : busionessid,
				pagetype : pagetype,
				pagetypeid : pagetypeid,
				sourceurl : api.pageParam.sourceurl,
				sourcetitle : api.pageParam.sourcetitle,
				accesspageurl : window.location.pathname,
				accesspagetitle : document.title,
				userinfo : userinfo
			}
			SendBehaviorTrajectoriesNotifi_Study(data);
		}
		function planTitleHtml(title, index, canBeManage){
			var topDiv = '<li class="mui-table-view-cell top-blank-div"></li>';
			var rightArrow = '';
			var planClass = '';
			if (index == 0 && page == 1) {
				topDiv = '';
			}
			// if (canBeManage == true) {//可以管理
				rightArrow = '<img class="plan-arrow" src="../../image/icon_youcejiantou.png">';
				planClass = ' can-be-manage';
			// }
			return topDiv+
				'<li index="'+index+'" class="mui-table-view-cell'+planClass+'">'+
					'<p class="plan-name-title">'+
						title+
					'</p>'+
					rightArrow+
				'</li>';
		}
		//添加点击事件
		function addCellClick(){
			$('.mui-table-view-cell').unbind('click');
			$('.mui-table-view-cell').click(function(){
				var index = $(this).attr('index');
				var data = courseDatas[parseInt(index)];
				setuPushNextWindow(data);
			});
			$('.cell-right-btn').unbind('click');
			$('.cell-right-btn').click(function(event){
				event.stopPropagation();
				var index = $(this).attr('index');
				var data = courseDatas[parseInt(index)];
				api.openWin({useWKWebView:true,
				    name: 'Teacher_CourseTestMakingWindow',
				    url: 'Teacher_CourseTestMakingWindow.html',
				    pageParam: {
						examid : data.examid,
						pid : data.planid,
						cid : data.courseid,
						type:0,//mocc
						sourceurl : api.pageParam.sourceurl,
					    sourcetitle : api.pageParam.sourcetitle,
				    }
				});
			});
			$('.can-be-manage').unbind('click');
			$('.can-be-manage').click(function(){
				var index = $(this).attr('index');
				var data = courseDatas[parseInt(index)];
				var params = {
					id : data.planid,
					pid : data.planid,
					title : data.title,
					btime : data.btime,
					etime : data.etime,
					status : 1,
					planType : 'edit'
				};
				api.openWin({useWKWebView:true,
				    name: 'StudyPlanEditWindow',
				    url: '../StudyPlanManage/StudyPlanEditWindow.html',
				    pageParam: params
				});
			});
		}
		function setuPushNextWindow(data){
			data["title"] = data.coursename;
			data["imgurl"] = data.coverimages;
			data["selected"] = 1;
			data["userType"] = data.usertype;
			if (data.isxueba == '1') {//学霸赛课程
				if (data.coursetype == 2108) {//自由课程
					openFree(data);
				}else if(data.coursetype == 2109){//慕课
					openXueBaMooc(data);
				}else{
					api.toast({
					    msg: '暂不支持该课程类型'
					});
				}
			}else{
				if (data.coursetype == 2108) {//自由课程
					openFree(data);
				}else if(data.coursetype == 2109){//慕课
					openMooc(data);
				}else{
					api.toast({
					    msg: '暂不支持该课程类型'
					});
				}
			}
		}
		function openXueBaMooc(data){
			var usertype = data.usertype;
		   	if (usertype == 1) {//老师
		   		api.openWin({useWKWebView:true,
				    name: 'Teacher_XueBaSaiMoocTag',
				    url: 'Teacher_XueBaSaiMoocTag.html',
				    pageParam: data
				});
		   	}else{
		   		api.openWin({useWKWebView:true,
		   		    name: 'Student_FreeCourseTab',
		   		    url: '../Study/Student_FreeCourseTab.html',
		   		    pageParam: data
		   		});
		   	}
		}
		//打开mooc课程
		function openMooc(data){
		   	data["sourceurl"]=api.pageParam.sourceurl;
		   	data["sourcetitle"]=api.pageParam.sourcetitle;
	   		api.openWin({useWKWebView:true,
			    name: 'Teacher_StudyCourseInfo',
			    url: 'Teacher_StudyCourseInfo.html',
			    pageParam: data
			});
			sendBuriedNotifi(1, '课程列表', '006');
		}
		function openFree(data){
		   	data["sourceurl"]=api.pageParam.sourceurl;
		   	data["sourcetitle"]=api.pageParam.sourcetitle;
		   	if (data.usertype == 1) {//老师
		   		api.openWin({useWKWebView:true,
				    name: 'Teacher_StudyFreeCourseTab',
				    url: 'Teacher_StudyFreeCourseTab.html',
				    pageParam: data,
		   		    slidBackEnabled: false
				});
			}else{
				api.openWin({useWKWebView:true,
				    name: 'Student_FreeCourseTab',
				    url: '../Study/Student_FreeCourseTab.html',
				    pageParam: data
				});
			}
			sendBuriedNotifi(1, '课程列表', '006');
		}
		//时间标签
		function timeTitleWithEndTime(endTime){
			var timeTitleHtml = '';
			var etime = parseInt(endTime) * 1000;//结束时间
			var nowTime = Date.parse(new Date());
			if (etime <= nowTime) {
				timeTitleHtml = '<p class="course-status-tag">已结束</p>';
			}else{
				var tmpTime = etime - nowTime;
				if (tmpTime <= oneWeek) {
					var timeDate = new Date(etime);
					var timeMonth = timeDate.getMonth() + 1;
					var timeDay = timeDate.getDate();
					var timeTitle = timeMonth + '-' + timeDay + '到期';
					timeTitleHtml = '<p class="course-status-tag">' + timeTitle + '</p>';
				}
			}
			return timeTitleHtml;
		}
		function studyCourseHtmlWithData(courseData, index){
			var timeTitleHtml = timeTitleWithEndTime(courseData.etime);
			var imageUrl = courseData.coverimages;
			var title = courseData.coursename;
			var schedule = "0";//进度
			var str = courseData.cjd;
			if (str == 'undefined' || str == '' || str == undefined) {
				str = '0';
			}
			if (str.indexOf("%") > 0) {
				var sarr = str.split('%');
				schedule = sarr[0];
			} else {
				schedule = courseData.cjd;
			}
			var courseJinDu = "";
			if (courseData.coursetype == 2108) {
				var videosum = parseInt(numNullStr(courseData.videosum));
				var videosums = parseInt(numNullStr(courseData.videosums));
				if (videosum > videosums) {
					videosum = videosums;
				}
				courseJinDu = '<p class="mui-ellipsis subtitle small-title bottom-p"><span class="left-span">自由课程</span><span class="right-span">已学习<span id="freeStudied'+courseData.courseid+'" class="course_schedule subtitle-red">'+videosum+'</span>/<span id="freeAllChapter'+courseData.courseid+'">'+videosums+'</span></span></p>';
			}else if(courseData.coursetype == 2109){
			 	courseJinDu = '<p class="mui-ellipsis subtitle small-title bottom-p"><span class="left-span">MOOC课程</span><span class="right-span">已学习 <span class="course_schedule subtitle-red">'+schedule+'%</span></span></p>';
			}else{
				courseJinDu = '<p class="mui-ellipsis subtitle small-title bottom-p">已学习 <span class="course_schedule subtitle-red">'+schedule+'%</span></p>';
			}
			return '<li id="' + courseData.courseid + '" index="'+index+'" class="mui-table-view-cell mui-media weui_media_appmsg">'+
					'<a href="javascript:;">'+
						timeTitleHtml+
						'<img class="mui-media-object mui-pull-left course-img" src="'+imageUrl+'">'+
						'<div class="mui-media-body top-content">'+
							'<p class="course_title">'+
								title+
							'</p>'+
						'</div>'+
						'<div class="mui-media-body bottom-content">'+
							'<div class="">'+
								'<p class="mui-ellipsis subtitle top-p">授课老师：'+courseData.speaker+'</p>'+
								courseJinDu+
							'</div>'+
						'</div>'+
					'</a>'+
				'</li>';
		}
		function courseHtmlWithData(data, index){
			var timeTitleHtml = timeTitleWithEndTime(data.etime);
			var cyArr = data.cydata;
			var testHtmlString = '';
			var workHtmlString = '';
			var cellRigthContent = '';
			var cellLeftContentClass = '';
			if (workHtmlString != '' || testHtmlString != '') {
				cellRigthContent = '<div class="cell-content-right">'+
							testHtmlString+
							workHtmlString+
						'</div>';
				cellLeftContentClass = 'cell-content-left';
			}
			var courseChapterString = '共'+numNullStr(data.chapternum)+'课时';
			var iconName = 'keshi';
			if (data.coursetype == '2108') {//自由课程
				courseChapterString = '共'+numNullStr(data.chapternum)+'章';
				iconName = 'zhangjie';
			}
			var examid = data.examid;
			var examBtn = '';
			var leftDivClass = '';
			if (examid != undefined && examid != null && examid != '' && examid != '0') {
				examBtn = '<div class="right-content">'+
						'<button index="' + index + '" type="button" class="mui-btn cell-btn cell-right-btn">批卷</button>'+
					'</div>';
				leftDivClass = 'left-content';	
			}
			var typeTagHtml = '<p class="course-type-tag">授课</p>';
			return '<li index="' + index + '" class="mui-table-view-cell mui-media">'+
				'<a href="javascript:;">'+
					timeTitleHtml+
					typeTagHtml+
					'<img class="mui-media-object mui-pull-left course-img" src="' + data.coverimages + '"/>'+
					'<div class="mui-media-body top-content">'+
						'<p class="course_title">' + data.coursename + '</p>'+
					'</div>'+
					'<div class="mui-media-body bottom-content">'+
						'<div class="top-p">'+
							'<p class="mui-ellipsis subtitle">'+
								'<span class="left-span"><img class="tag-img" src="../../image/icon_'+iconName+'.png">'+courseChapterString+'</span>'+
							'</p>'+
						'</div>'+
						'<div class="bottom-p">'+
							'<div>'+
								'<p class="mui-ellipsis subtitle">'+
									'<span class="left-span"><img class="tag-img" src="../../image/icon_ren.png">'+numNullStr(data.countnum)+'人</span>'+
									'<span class="info-span"><img class="tag-img" src="../../image/icon_shijian.png">'+minuteWithSecond(numNullStr(data.timenum))+'分</span>'+
								'</p>'+
							'</div>'+
						'</div>'+
					'</div>'+
				'</a>'+
			'</li>';
		}
		function minuteWithSecond(second){
			// return (parseInt(second) / 60).toFixed(0);//该方法会四舍五入
			return parseInt(parseInt(second) / 60);
		}
		function imageUrlWithStr(string){
			if (string.indexOf("http://") == -1) {
				if (string.indexOf("learn/") == -1) {
					return 'http://bos.cfnet.org.cn/' + string;
				}else{
					return 'http://cfnet.org.cn/data/uploads/' + string;
				}
			}else{
				return string;
			}
		}
		//打开最近测验章节批改列表
		function openLatelyTest(pid,cid,examid, event){
			event.stopPropagation();
			api.openWin({useWKWebView:true,
		        name : 'Teacher_CourseTestMakingWindow.html',
			    url : '../Teacher_Teach/Teacher_CourseTestMakingWindow.html',
			    pageParam: {
		   　　　	examid : examid,
					cid : cid,
					pid : pid,
					sourceurl : api.pageParam.sourceurl,
					sourcetitle : api.pageParam.sourcetitle,
					
			 	}
	        });
	        sendBuriedNotifi(1, '课程列表', '006');
		}
		//作业批阅
		function workBtnClick(pid,cid,vid,rid, event){
	        event.stopPropagation();
	        api.openWin({useWKWebView:true,
				name : 'Teacher_HomeWorkMarkingManage_StudentWindow',
				url : 'Teacher_HomeWorkMarkingManage_StudentWindow.html',
				pageParam : {
					vid : vid,
			        pid : pid,
			        cid : cid,
			        wid : rid,
			        sourceurl : api.pageParam.sourceurl,
					sourcetitle : api.pageParam.sourcetitle,
				}
			});
			sendBuriedNotifi(1, '课程列表', '006');
		}
		function refreshData(){
			firstLoad = true;
			loadNewData();
		}
		function numNullStr(str){
			if (str == null || str == '' || str == undefined) {
				return 0;
			}
			return str;
		}
	</script>
</html>